import com.beans.*;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * Created with IntelliJ IDEA.
 * Description:
 */
public class App {
    public static void main(String[] args) {
        ApplicationContext context =
                new ClassPathXmlApplicationContext("spring-config.xml");
        UserTestBean2 user = context.getBean(UserTestBean2.class);
        UserTestBean1 user2 = context.getBean(UserTestBean1.class);
        System.out.println(user.test());
        System.out.println(user2.test());;
//        UserController4 userController4 = context.getBean(UserController4.class);
//        userController4.hello();
//        UserController3 userController = context.getBean(UserController3.class);
//        userController.hello();
        //        UserController2 userController2 =
//                context.getBean("userController2", UserController2.class);
//        userController2.hello();
//        UserController controller = context.getBean("userController", UserController.class);
//        controller.hello();
//        User user = context.getBean("user1", User.class);
//        System.out.println(user);
        // id 默认是使用类名的小驼峰形式
//        UserController userController = context.getBean("userController", UserController.class);
//        userController.hello();
//        UserService userService = context.getBean("userService", UserService.class);
//        userService.hello();
//        UserRepository userRepository = context.getBean("userRepository", UserRepository.class);
//        userRepository.hello();
//        UserConfiguration userConfiguration = context.getBean("userConfiguration", UserConfiguration.class);
//        userConfiguration.hello();
//        UserComponent userComponent = context.getBean("userComponent", UserComponent.class);
//        userComponent.hello();
    }
}
